<?php /*a:3:{s:58:"D:\phpstudy_pro\WWW\2021RBAC\app\admin\view\posts\add.html";i:1614582175;s:62:"D:\phpstudy_pro\WWW\2021RBAC\app\admin\view\public\header.html";i:1614582963;s:62:"D:\phpstudy_pro\WWW\2021RBAC\app\admin\view\public\footer.html";i:1613818404;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="/static/jquery.min.js"></script>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <script src="/static/layui/layui.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">个人博客后台管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="/admin/home/index">个人主页</a></li>
<!--            <li class="layui-nav-item"><a href="">商品管理</a></li>-->
<!--            <li class="layui-nav-item"><a href="">用户</a></li>-->
<!--            <li class="layui-nav-item">-->
<!--                <a href="javascript:;">其它系统</a>-->
<!--                <dl class="layui-nav-child">-->
<!--                    <dd><a href="">邮件管理</a></dd>-->
<!--                    <dd><a href="">消息管理</a></dd>-->
<!--                    <dd><a href="">授权管理</a></dd>-->
<!--                </dl>-->
<!--            </li>-->
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    贤心
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->

            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <?php foreach($url as $val): ?>
                <li class="layui-nav-item layui-nav-itemed">

                    <a class="" href="javascript:;"><?php echo htmlentities($val['node_name']); ?></a>
                    <dl class="layui-nav-child">
                        <?php if(isset($val['child'])): foreach($val['child'] as $v): ?>
                            <dd><a href="<?php echo htmlentities($v['node_url']); ?>"><?php echo htmlentities($v['node_name']); ?></a></dd>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </dl>
                </li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">

<title>帖子<?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): ?>修改<?php else: ?>发布<?php endif; ?></title>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>帖子<?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): ?>修改<?php else: ?>发布<?php endif; ?></legend>
</fieldset>

<!-- 加载编辑器的容器 -->

<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>

<form class="layui-form" action="" method="post" enctype="multipart/form-data">

    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">文章设置</li>
            <li>文章内容</li>

        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): ?> <input type="hidden" name="id" value="<?php echo htmlentities($user_posts['id']); ?>"> <?php endif; ?>

                <div class="layui-form-item">
                    <label class="layui-form-label">帖子标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="post_title" required <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): ?> value="<?php echo htmlentities($user_posts['post_title']); ?>" <?php endif; ?> lay-verify="required" placeholder="请输入帖子标题" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div style="margin-left: 110px;">
                    <input id="filed" name="post_img" type="file" <?php if(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty())): ?> required lay-verify="required" <?php endif; ?>  style="display:none;">
                    <button type="button" class="layui-btn" id="my-img"><i class="layui-icon">&#xe67c;</i>上传文章封面</button>

                    <div id="box" style="margin: 20px 0 20px 0">
                        <img id="imgshow" <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): ?> src="http://www.2021rbac.com/<?php echo htmlentities($user_posts['post_img']); ?>" <?php endif; ?>/>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">文章分类</label>
                    <div class="layui-input-block">
                        <select name="cate_id" lay-verify="required">
                            <option value=""></option>
                            <?php foreach($cate as $v): ?>
                            <option value="<?php echo htmlentities($v['id']); ?>" <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): if($user_posts['cate_id'] == $v['id']): ?>selected<?php endif; ?><?php endif; ?> ><?php echo htmlentities($v['cate_name']); ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="0" <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): if($user_posts['status'] == 0): ?>checked<?php endif; else: ?>checked<?php endif; ?> title="发布">
                        <input type="radio" name="status" value="1" <?php if(!(empty($user_posts) || (($user_posts instanceof \think\Collection || $user_posts instanceof \think\Paginator ) && $user_posts->isEmpty()))): if($user_posts['status'] == 1): ?>checked<?php endif; ?><?php endif; ?> title="未发布" >
                    </div>
                </div>

            </div>
            <div class="layui-tab-item">
                <blockquote class="layui-elem-quote">文章内容</blockquote>

                <script id="container" name="post_content" style="height: 300px;display: block" type="text/plain">
                    <?php
                        if(!empty($user_posts)){
                            echo $user_posts['post_content'];
                        }
                    ?>
                </script>
            </div>

        </div>
    </div>




    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<style>
    #box {
        width: 120px;
        height: 120px;

    }

    #imgshow {
        width: 100%;
        height: 100%;
    }
</style>



<script>
    $("#filed").change(function(){
        $("#imgshow").attr("src",URL.createObjectURL($(this)[0].files[0]));
    });

    $(document).ready(function(){
        $('#my-img').click(function(){
            $('#filed').click();
        });

    });
</script>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){

        });
    });
</script>

</div>
</div>

<div class="layui-footer">
    <!-- 底部固定区域 -->
    © layui.com - 底部固定区域
</div>
</div>

<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
</script>
</body>
</html>